package io.gitee.zhangbinhub.acp.boot.test

import io.gitee.zhangbinhub.acp.boot.log.LogAdapter
import io.gitee.zhangbinhub.acp.boot.websocket.reactive.AcpWebSocketClient
import java.nio.ByteBuffer

class TestAcpWebSocketClientReactive(
    logAdapter: LogAdapter, clientId: String
) : AcpWebSocketClient(logAdapter, clientId) {
    override fun sessionOpen(session: org.springframework.web.reactive.socket.WebSocketSession) {
        println("session open")
        sendMessage("第一个消息")
    }

    override fun sessionClose(session: org.springframework.web.reactive.socket.WebSocketSession) {
        println("session close")
    }

    override fun sessionError(
        session: org.springframework.web.reactive.socket.WebSocketSession?,
        throwable: Throwable?
    ) {
        println("session error: ${throwable?.message}")
    }

    override fun receiveMessage(
        session: org.springframework.web.reactive.socket.WebSocketSession,
        message: ByteBuffer
    ) {
        println("收到消息：$message")
    }

    override fun receiveMessage(session: org.springframework.web.reactive.socket.WebSocketSession, message: String) {
        println("收到消息：$message")
    }
}